package com.qingcheng.dao;

import com.qingcheng.pojo.system.Resource;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
<<<<<<< HEAD

public interface ResourceMapper extends Mapper<Resource> {
    /**
     * 根据用户名查询资源key列表
     * @param username
     * @return
     */
    @Select("SELECT `res_key` FROM `tb_resource` WHERE `id` IN (  " +
            "SELECT `resource_id` FROM `tb_role_resource` WHERE `role_id` IN (  " +
            "   SELECT `role_id` FROM `tb_admin_role` WHERE `admin_id` IN (  " +
            "      SELECT `id` FROM `tb_admin` WHERE `login_name`=#{username} " +
            "       ) " +
            "    ) " +
            ") ")
    public List<String> keyList(@Param("username") String username);
=======

public interface ResourceMapper extends Mapper<Resource> {

    @Select("SELECT id,res_key as resKey,res_name as resName,parent_id as parentId FROM `tb_resource` where id in (select resource_id as id from tb_role_resource where role_id = #{id})")
    List<Resource> findByRoleId(@Param(("id")) Integer id);

>>>>>>> origin/zzy
}
